Skip to content

fix(setups): add the flattened klarna, paypal, tabby and stc pay fields - #277

Merged
rodrigojara-cko merged 2 commits into
masterfrom
feat/INT-1729-payment-setup-flattened-methods
Oct 22, 2026
Merged

rodrigojara-cko merged 2 commits into
masterfrom
feat/INT-1729-payment-setup-flattened-methods

Conversation

@rodrigojara-cko

@rodrigojara-cko rodrigojara-cko commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Payment Setup returns the next action of each payment method directly on the method (payment_methods.klarna.action, payment_methods.paypal.action, payment_methods.stcpay.action). The Go types did not model it, so GetPaymentSetup dropped it and a merchant could not read the Klarna client token or the PayPal order ID needed to launch those flows. This adds the action and the other fields the spec defines for Klarna, PayPal, Tabby and stc pay. The spec defines a different action object per method, so each method gets its own action type, as Cash App, Pay by Bank and Instrument already do.

Changes

  • payments/setups/setups.go:
    • KlarnaPaymentMethod: read-only Action (*KlarnaAction) and Iban.
    • PaypalPaymentMethod: BrandName (max 127 characters), ShippingPreference and read-only Action (*PaypalAction).
    • StcpayPaymentMethod: read-only Action (*StcpayAction); Otp documented as write only.
    • TabbyPaymentMethod: PaymentTypes ([]string).
    • New KlarnaAction (Type, ClientToken, SessionId), PaypalAction (Type, OrderId) and StcpayAction (Type), with KlarnaActionType (sdk), PaypalActionType (sdk) and StcpayActionType (otp).
    • New PaypalShippingPreference with PaypalShippingPreferenceNoShipping, PaypalShippingPreferenceGetFromFile and PaypalShippingPreferenceSetProvidedAddress.
    • PaymentMethodOptions on Klarna, PayPal, stc pay and Tabby marked deprecated (see below).
  • payments/setups/setups_fields_test.go: literal wire keys for the PayPal and Tabby request fields (read-only action and payment_method_options not sent), every PaypalShippingPreference and action type value, deserialization of action from Klarna, PayPal and stc pay plus Klarna iban from a response with the spec examples, and a roundtrip of every new property.
  • test/payment_setups_test.go: comment updated to the flattened shape.

API Reference

Deprecated

  • PaymentMethodOptions on KlarnaPaymentMethod, PaypalPaymentMethod, StcpayPaymentMethod and TabbyPaymentMethod. The API removed payment_method_options: it no longer sends it and ignores it on requests. Use Action instead (Tabby has no replacement). It will be removed in the next major version. Requested in review.

Breaking changes

None. Only new fields and types, and deprecation notices. PaypalPaymentMethod.UserAction stays a string.

README

No change needed.

Payment Setup returns each payment method's next action directly on the
method. The Go types dropped it on unmarshal, so the Klarna client token and
the PayPal order ID could not be read. Adds the action and the request fields
the spec defines for Klarna, PayPal, Tabby and stc pay.
@agent-wall-e

agent-wall-e Bot commented Oct 20, 2026

Copy link
Copy Markdown

🟢 Risk Classification: LOW

Approval route: AI Auto-Approval
Rollback controls: Automated Instant Rollback + feature flags

Classification reasons

  • no_low_class_matched
  • prod_source_modified
  • 2.2.6_logical_extension:The PR only adds new read-only response fields and optional request fields to existing payment method structs, reusing existing types and endpoints without introducing new endpoints, external integrations, persisted data classes, auth changes, or background processes.

Operational gates

  • ✅ jira_ticket (INT-1729)
  • ✅ independent_review

Files analysed: 2


wall-e 2026.06.19-02 · policy 6b4ce2b3b45a…

@agent-wall-e

agent-wall-e Bot commented Oct 20, 2026

Copy link
Copy Markdown
🔬 Debug — why this classification?

Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.

Reason code Kind Clause Meaning
no_low_class_matched informational §2.2 (fall-through) None of the deterministic Low classes (§2.2.3, §2.2.4, §2.2.7, docs-only) applied; classifier fell through to LLM evaluation.
prod_source_modified informational §2.1 M7 (informational) At least one file is non-doc, non-test, non-IaC — i.e. application source code was modified.
2.2.6_logical_extension — The PR only adds new read-only response fields and optional request fields to existing payment method structs, reusing existing types and endpoints without introducing new endpoints, external integrations, persisted data classes, auth changes, or background processes. classifying §2.2.6 Sonnet 4.6 evaluator promoted minor → low: the change reuses existing code paths and does not cross a trust boundary.

Kinds:

  • classifying — this rule contributed to the chosen tier.
  • informational — context only; did not by itself decide the tier.

See issue #3 for the proposal to formalise this map as Appendix A of the standards doc.

wall-e 2026.06.19-02 · debug

The spec defines a different action object for each payment method, so
each one gets its own type with a typed action type, as Cash App, Pay by
Bank and Instrument already do. Also deprecates the payment_method_options
the API no longer sends on the touched methods, as requested in review.
@agent-wall-e

agent-wall-e Bot commented Oct 22, 2026

Copy link
Copy Markdown

🟡 Risk Classification: MINOR

Approval route: AI Review + Human Approval
Rollback controls: Staged rollout + rollback

Classification reasons

  • exceeds_bounded_scope:285>250

Operational gates

  • ✅ jira_ticket (INT-1729)
  • ✅ independent_review

Files analysed: 3


wall-e 2026.06.19-02 · policy 6b4ce2b3b45a…

@agent-wall-e

agent-wall-e Bot commented Oct 22, 2026

Copy link
Copy Markdown
🔬 Debug — why this classification?

Each reason code emitted by the classifier, its source clause in the AI in SDLC Control Framework, and what it means.

Reason code Kind Clause Meaning
exceeds_bounded_scope — 285>250 classifying §2.1 M8 More than 250 non-test, non-doc, non-lockfile lines changed.

Kinds:

  • classifying — this rule contributed to the chosen tier.
  • informational — context only; did not by itself decide the tier.

See issue #3 for the proposal to formalise this map as Appendix A of the standards doc.

wall-e 2026.06.19-02 · debug

@agent-wall-e

agent-wall-e Bot commented Oct 22, 2026

Copy link
Copy Markdown

🟢 Advisory review: Looks good to me

This PR still needs a human approval — wall-e cannot auto-approve it. For what it's worth, I read the diff and found nothing I'd block on.

Adds flattened action, IBAN, brand_name, shipping_preference, and payment_types fields to Klarna, PayPal, Tabby, and stc pay payment method structs, with matching tests covering wire keys, enum values, deserialization, and round-trips. The changes are additive and non-breaking, and the tests verify the claims in the description.

What I checked

  • New fields are correctly tagged with omitempty so unset read-only fields (e.g., Action) are not serialized in requests, which the wire-key test explicitly verifies.
  • PaypalAction and PaypalActionType types (referenced in tests as PaypalActionTypeSdk and PaypalAction.OrderId) are not visible in the truncated diff but are exercised by tests that compile and pass, so they must exist in the non-truncated portion.
  • Deprecation notices on PaymentMethodOptions fields are accurate and consistent across all four methods.
  • The round-trip test constructs PaymentMethods with both Otp (write-only) and Action (read-only) set simultaneously on StcpayPaymentMethod, which is a valid test scenario since Go has no enforcement of write-only constraints.
  • No existing tests are removed or weakened; only new test cases are added.

⚠️ The diff was too large to read in full, so this review covers only part of the change.


This is not an approval. wall-e cannot auto-approve this PR — it is an opinion to help whoever does. Advisory review · us.anthropic.claude-sonnet-4-6 · wall-e 2026.06.19-02

@sonarqubecloud

Copy link
Copy Markdown

@rodrigojara-cko
rodrigojara-cko merged commit c1676f6 into master Oct 22, 2026
5 of 6 checks passed
@rodrigojara-cko
rodrigojara-cko deleted the feat/INT-1729-payment-setup-flattened-methods branch October 22, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants